<!DOCTYPE html>
<html>
<head>
<title>角色管理</title>
#parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.roleName" @keyup.enter="query" maxlength="10" placeholder="角色名称，请输入2-10个中英文、数字进行查询" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g,'')">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			
			#if($shiro.hasPermission("sys:role:save"))
			<a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			#end
			#if($shiro.hasPermission("sys:role:update"))
			<a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			#end
			#if($shiro.hasPermission("sys:role:delete"))
			<a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
			#end
		</div>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </div>
    
    <div v-show="!showList" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal">
			<div class="form-group">
			   	<div class="col-sm-2 control-label">角色名称</div>
			   	<div class="col-sm-10">
			      <input id="input_rolename"  type="text" class="form-control" maxlength="10" v-model="role.roleName" placeholder="角色名称只能是2-10个中英文、数字" onblur="isrolename()" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g,'')"/>
			    </div>
			</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">备注</div>
			   	<div class="col-sm-10">
			      <input id="input_remarks"  type="text" class="form-control" maxlength="50" v-model="role.remark" placeholder="备注只能是50个中英文、数字长度之内" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g,'')"/>
			    </div>
			</div>
			<div class="form-group">
			   	<div class="col-sm-2 control-label">授权</div>
			   	<div class="col-sm-10">
			      <ul id="menuTree" class="ztree"></ul>
			    </div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label"></div> 
				<input id="submitBtn" type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
	function isrolename(){
	    var rolename = $("#input_rolename").val();
	    if(rolename.length > 12 || rolename.length < 2){
	        alert("请输入2-15个长度的角色名称");
	        return false;
		}
	}
    function isremarks(){
        var remarks = $("#input_remarks").val();
        if(remarks.length > 50){
            alert("请输入50个长度之内的备注");
            return false;
        }
    }
</script>
<script src="${rc.contextPath}/js/sys/role.js?_${date.systemTime}"></script>    
</body>
</html>